      {if $action eq 'index' or $action eq 'search' or $action eq 'show' or $action eq 'inforss'}
      <div style="width:300px;border:1px solid black;padding:5px;float:right;margin-bottom:5px;">
         {$lang.rss_banner}<a href="/index.php?c=event&amp;a=inforss">{$lang.rss_banner_link}</a>
      </div>

      {literal}
      <script type="text/javascript">
         function sendForm() {
            var when = document.getElementById('select_when').value;
            if (when != "") {
               document.location = '/index.php?c=event&a=search&when='+when;
            }
            var where = document.getElementById('select_where').value;
            if(where != "") {
               document.location = '/index.php?c=event&a=search&where='+where;
            }
         }
      </script>
      {/literal}

      <h2>{$lang.what_to_do}</h2>
      <div style="clear:right;padding:5px;height:100px;border:1px solid black;">
         <div style="float:left;height:100px;padding-right:5px;">
            <h3>{$lang.where}</h3>
            <select id="select_where" onchange="sendForm();">
               <option value="">{$lang.regions}</option>
               <option value="">&nbsp;</option>
               {foreach from=$regions item=region}
               <option value="{$region->getId()}">{$region->getName()}</li>
               {/foreach}
            </select>
         </div>

         <div style="float:left;border-left:1px solid black;height:100px;padding:0 5px 0 5px;">
            <h3>{$lang.when}</h3>
            <select id="select_when" onchange="sendForm();">
               <option value="">{$lang.select_date}</option>
               <option value="">&nbsp;</option>
               <option value="week">{$lang.this_week}</option>
               <option value="t_month">{$lang.this_month}</option>
               <option value="n_month">{$lang.next_month}</option>
               <option value="o_month">{$lang.others_months}</option>
            </select><br />
            <!-- Calendario para buscar por día -->
         </div>

         <div style="float:left;border-left:1px solid black;height:100px;padding-left:5px;">
            <a href="/index.php?c=event&amp;a=create">{$lang.add_event}</a>
         </div>
      </div>

      <div style="float:right;padding:5px;width:160px;margin-top:10px;">
         {$lang.search_keyword}<br />
         <form method="get" action="/index.php">
            <input type="hidden" name="c" value="event" />
            <input type="hidden" name="a" value="search" />
            <input type="text" name="what" onblur="if(this.value=='') this.value='{$lang.search}';" onfocus="if(this.value=='{$lang.search}') this.value='';" value="{$lang.search}" />
         </form>
      </div>
      <div style="clear:both; padding-top:10px;">
      {if $action eq 'inforss'}
      {***************************************}
      {*                                     *}
      {* EDIT OR CREATE EVENT                *}
      {*                                     *}
      {***************************************}
      <h2>{$lang.what_is_rss}</h2>
      <p>{$lang.rss_description}</h2>
      <p>{$lang.rss_directory}</p>
      <ul>
         {foreach from=$regions item=region}
         <li><a href="/index.php?c=event&amp;a=rss&amp;region={$region->getId()}">{$region->getName()}</a></li>
         {/foreach}
      </ul>

      {elseif $action eq 'index' or $action eq 'search'}

      {***************************************}
      {*                                     *}
      {* INDEX AND SEARCH                    *}
      {*                                     *}
      {***************************************}

         <h2>{$lang.next_events}</h2>
         {if $events}
         {foreach from=$events item=event}
         <div style="border:1px solid black; padding:10px;margin-top:10px;">
            {$event->getCategory()}<br />
            <h3><a href="index.php?c=event&amp;a=show&amp;id={$event->getId()}">{$event->getName()}</a></h3>
            {$lang.when}
            {if $event->getDateEnd() neq $event->getDateStart()}
               Del {$event->getDateStart()} al {$event->getDateEnd()}
            {else}
               El {$event->getDateStart()}
            {/if}
            <br />
            {$lang.where} {$event->getCity()}<br />
            {$lang.promote} {$event->getPromoter()} <br />
            {assign var=event_user value=$event->getUser()}
            {$lang.inserted_by} <a href="/index.php?c=user&amp;a=show&amp;id={$event_user->getId()}">{$event_user} {if $event_user->getAvatar()}<img src="/z-content/img/avatars/{$event_user->getId()}.jpg" alt="{$event_user}"/>{/if}</a><br />
            <a href="/index.php?c=event&amp;a=show&amp;id={$event->getId()}">{$lang.more_info}</a><br />
            {$lang.comments_on_event}: (<a href="index.php?c=event&amp;a=show&amp;id={$event->getId()}#comments">{$event->getNumComments()}</a>)<br />
         </div>
         {/foreach}
         {foreach from=$pagination key=num item=link}
         {if $page neq $num}
         <a href="{$link}">{$num}</a>
         {else}
         {$num}
         {/if}
         {/foreach}
         {/if}

      {elseif $action eq 'show'}
      {***************************************}
      {*                                     *}
      {* SHOW EVENT                          *}
      {*                                     *}
      {***************************************}

      <div style="border:1px solid black;padding:5px;">
         Categoria {$event->getCategory()}<br />
         <h2>{$event->getName()}</h2>
         {$event->getDescription()}<br />
         {$lang.where_2}: {$event->getPlace()} {$event->getAddress()} {$event->getCity()}<br />
         {$lang.when_2}:
         {if $event->getDateEnd() neq $event->getDateStart()}
            {$lang.from} {$event->getDateStart()} {$lang.to} {$event->getDateEnd()}
         {else}
            {$lang.on} {$event->getDateStart()}
         {/if}
         <br />
         {if $event->getDateDetails()}
            {$event->getDateDetails()}<br />
         {/if}
         {if $event->getTime()}
            {$event->getTime()}<br />
         {/if}
         {if $event->getPromoter()}
            {$lang.promoter}: {$event->getPromoter()}<br />
         {/if}
         {if $event->getCost()}
            {$lang.cost}: {$event->getCost()}<br />
         {/if}
         {if $event->geturl()}
            {$lang.website}: {$event->getUrl()}<br />
         {/if}
         {if $event->getPhone()}
            {$lang.phone}: {$event->getPhone()}<br />
         {/if}
         {if $event->getAforo()}
            {$lang.aforo}: {$event->getAforo()}<br />
         {/if}
         {if $event->getTags()}
            {$lang.about}: {$event->getTags()}<br />
         {/if}
         {assign var=event_user value=$event->getUser()}
         {$lang.inserted_by}: <a href="/index.php?c=user&amp;a=show&amp;id={$event_user->getId()}">{$event_user} {if $event_user->getAvatar()}<img src="/z-content/img/avatars/{$event_user->getId()}.jpg" alt="{$event_user}"/>{/if}</a><br />
      </div>

      {literal}
      <script type="text/javascript">
         function showShare() {
            document.getElementById('share').style.display='block';
            var share_link = document.getElementById('share_link');
            share_link.style.paddingBottom = '11px';
            share_link.style.borderBottom = '0px';
         }
      </script>
      {/literal}

      <ul style="list-style:none;padding-left:0px;margin-bottom:10px;">
         <li style="display:inline;border:1px solid black;padding:5px;background-color:#FFF;"><a href="javascript:self.print()">{$lang.print}</a></li>
         <li style="display:inline;border:1px solid black;padding:5px;background-color:#FFF;" onclick="showShare();" id="share_link"><a href="#share_link">{$lang.share}</a></li>
         <li style="display:inline;border:1px solid black;padding:5px;background-color:#FFF;"><a href="/index.php?c=event&amp;a=abuse&amp;id={$event->getId()}">{$lang.abuse}</a></li>
         {if $user->getLevel() eq 'admin'}
         <li style="display:inline;border:1px solid black;padding:5px;background-color:#FFF;"><a href="/index.php?c=event&amp;a=edit&amp;id={$event->getId()}">{$lang.edit}</a></li>
         {/if}
      </ul>
      <form id="share" style="border:1px solid black;padding:5px;display:none;z-index=-1" method="post" action="/index.php?c=event&amp;a=share&amp;id={$event->getId()}">
         De <input type="text" value="" name="from" /><br />
         Para <input type="text" value="" name="to" /><br />
         Mensaje <textarea name="message"></textarea><br />
         <input type="submit" value="{$lang.send}"></submit>
      </form>
      <h2><a href="#comments">{$lang.add_comment}</a></h2>
      Comentarios: {$event->getNumComments()}<br />
      <div id="comments">
         {foreach from=$event->getComments() item=comment}
         <div style="border:1px solid black;margin-top:10px;padding:5px;">
            {$comment->getDatePost()}
            {$comment->getText()}
            {assign var=comment_user value=$comment->getUser()}
            <p style="text-align:right;"><a href="/index.php?c=user&amp;a=show&amp;id={$comment_user->getId()}">{$comment_user} {if $comment_user->getAvatar()}<img src="/z-content/img/avatars/{$comment_user->getId()}.jpg" alt="{$comment_user}"/>{/if}</a></p>
            {if $user->getLevel() eq admin}
            {literal}
            <SCRIPT language="JavaScript">
            <!--
            function del_comment(id)
            {
               {/literal}
               var val = confirm("{$lang.confirm_del_comment}");
               {literal}
               if (val) {
                  window.location="/index.php?c=event&a=commentdel&id="+id;
               }
            }
            //-->
            </SCRIPT>
            {/literal}
            <a href="javascript:del_comment({$comment->getId()})">{$lang.delete}</a>
            <a href="/index.php?c=event&amp;a=commentedit&amp;id={$comment->getId()}">{$lang.edit}</a>
            {/if}
         </div>
         {/foreach}
      </div>

      <p>{$lang.want_to_comment} {$lang.comment_advise}</p>
      <form method="post" action="/index.php?c=event&amp;a=commentAdd&amp;id={$event->getId()}">
         <textarea name="comment"></textarea><br />
         <button type="send">{$lang.send}</button>
      </form>
      {/if}
         <div style="text-align:right">
            <a href="http://zoowa.net/">{$lang.powered_by_zoowa}</a>
         </div>
      </div>

      {elseif $action eq 'create' or $action eq 'edit'}
      {***************************************}
      {*                                     *}
      {* EDIT OR CREATE EVENT                *}
      {*                                     *}
      {***************************************}
      {literal}
      <script type="text/javascript">
         var AjaxZoowa=function(params,handler) {
            var xmlHttp;
            var url = "index.php?c=ajax&a=";
            try{
               xmlHttp=new XMLHttpRequest();
            } catch(e) {
               try{
                  xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
               } catch(e) {
                  try {
                     xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
                  } catch(e) {
                     alert("Your browser does not support AJAX!");
                     return false;
                  }
               }
            }
            xmlHttp.onreadystatechange = function(){
               if(xmlHttp.readyState==4){
                  handler(xmlHttp);
               }
            }
            xmlHttp.open("GET",url+params,true);
            xmlHttp.send(null);
         };


         function showRegion() {
            var val=document.getElementById("country").value;
            document.getElementById("region").style.display="none";
            var handler = function(transport) {
               var regTags=transport.responseXML.getElementsByTagName('region');
               document.getElementById("region").options.length=0;
               if (regTags.length > 0) {
                  for(var i=0;i<regTags.length;i++) {
                     var reg_name=regTags[i].getAttribute('name');
                     var reg_id=regTags[i].getAttribute('id');
                     document.getElementById("region").options[i] = new Option(reg_name,reg_id);
                  }
                  document.getElementById('region').style.display="inline";
               }
            }
            var params="regions&country="+val;
            AjaxZoowa(params,handler);
         }

         function showCity() {
            var val=document.getElementById("region").value;
            document.getElementById("city").style.display="none";
            var handler = function(transport) {
               var cityTags=transport.responseXML.getElementsByTagName('city');
               document.getElementById("city").options.length=0;
               for(var i=0;i<cityTags.length;i++) {
                  var city_name=cityTags[i].getAttribute('name');
                  var city_id=cityTags[i].getAttribute('id');
                  document.getElementById("city").options[i] = new Option(city_name,city_id);
               }
               document.getElementById('city').style.display="inline";
            }
            var params="cities&region="+val;
            AjaxZoowa(params,handler);
         }
      </script>{/literal}
      {if $action eq 'create'}
      <h2>{$lang.event_create}</h2>
      {else}
      <h2>{$lang.event_edit}</h2>
      {/if}

      {if $error}
      <ul>
         {foreach from=$error item=err}
         <li>{$err}</li>
         {/foreach}
      </ul>
      {/if}

      <form {if $action eq 'create'} action="?c=event&amp;a=add"{else} action="?c=event&amp;a=edit&amp;id={$id}" {/if} method="post">
         <h4><label>{$lang.title}</label></h4>
         <p>{$lang.title_suggest}</p>
         <input type="text" name="name" value="{$name}" maxlength="90" />

         <h4><label>{$lang.category}</label></h4>
         <select name="category" size="8">
            {foreach from=$categories item=cat}
            <option value="{$cat->getId()}" {if $category eq $cat->getId()}selected="selected"{/if} >{$cat->getName()}</option>
            {/foreach}
         </select>


         <h4><label>{$lang.cost}</label></h4>
         <p>{$lang.cost_suggest}</p>
         <input type="text" name="cost" value="{$cost}"  maxlength="128" />

         <h4><label>{$lang.aforo}</label></h4>
         <p>{$lang.aforo_suggest}</p>
         <input type="radio" name="aforo" value="limited" onchange="document.getElementById('num_aforo').style.display='inline'" {if $aforo eq 'limited'} checked="checked" {/if}>{$lang.limited}</input>
         <input id="num_aforo" {if $aforo neq 'limited'} style="display:none;" {/if} type="text" name="num_aforo" value="{$num_aforo}" /><br />
         <input type="radio" name="aforo" value="unlimited" onchange="document.getElementById('num_aforo').style.display='none'" {if $aforo eq 'unlimited'} checked="checked" {/if}>{$lang.unlimited}</input><br />
         <input type="radio" name="aforo" value="unknown" onchange="document.getElementById('num_aforo').style.display='none'" {if $aforo eq 'unknown' or not $aforo} checked="checked" {/if}>{$lang.unknown}</input><br />

         <h4><label>{$lang.description}</label></h4>
         <textarea name="description">{$description}</textarea>

         <h4><label>{$lang.promoter}</label></h4>
         <input type="text" name="promoter" value="{$promoter}"  maxlength="128" />

         <h4><label>{$lang.date_start}</label></h4>
         {html_select_date prefix="date_start_" end_year="+1" field_order="DMY" month_format="%m" time="$date_start"}
         <h4><label>{$lang.moreaday}</label></h4>
         <p>{$lang.moreaday_suggest}</p>
         <input type="radio" name="moreaday" value="yes" onclick="document.getElementById('date_end').style.display='block';" {if $moreaday eq 'yes'} checked="checked" {/if}>{$lang.yes}</input><br />
         <input type="radio" name="moreaday" value="no" onclick="document.getElementById('date_end').style.display='none';" {if $moreaday neq 'yes'} checked="checked" {/if}>{$lang.no}</input>

         <div {if $moreaday neq 'yes'} style="display:none;" {/if} id="date_end">
         <h4><label>{$lang.date_end}</label></h4>
         {html_select_date prefix="date_end_" end_year="+1" field_order="DMY" month_format="%m" time="$date_end"}
         </div>

         <h4><label>{$lang.date_details}</label></h4>
         <p>{$lang.date_details_suggest}</p>
         <input type="text" name="date_details" value="{$date_details}" maxlength="128" />

         <h4><label>{$lang.time}</label></h4>
         <p>{$lang.time_suggest}</p>
         <input type="text" name="time" value="{$time}" maxlength="128" />

         <h4><label>{$lang.town}</label></h4>
         <p>{$lang.town_suggest}</p>
         <select name="country" size="8" id="country" onchange="showRegion();">
            {foreach from=$countries item=tmp_country}
            <option value="{$tmp_country->getId()}" {if $country eq $tmp_country->getId()}selected="selected"{/if}>{$tmp_country->getName()}</option>
            {/foreach}
         </select>
         <select name="region" size="8" id="region" {if not $regions} style="display:none;" {/if} onchange="showCity();">
            {if $regions}
            {foreach from=$regions item=tmp_region}
            <option value="{$tmp_region->getId()}" {if $region eq $tmp_region->getId()}selected="selected"{/if}>{$tmp_region->getName()}</option>
            {/foreach}
            {/if}
         </select>
         <select name="city" size="8" id="city" {if not $cities} style="display:none;" {/if} >
            {if $cities}
            {foreach from=$cities item=tmp_city}
            <option value="{$tmp_city->getId()}" {if $city eq $tmp_city->getId()}selected="selected"{/if}>{$tmp_city->getName()}</option>
            {/foreach}
            {/if}
         </select>

         <h4><label>{$lang.address}</label></h4>
         <p>{$lang.address_suggest}</p>
         <input type="text" name="address" value="{$address}" maxlength="128" />

         <h4><label>{$lang.place}</label></h4>
         <p>{$lang.place_suggest}</p>
         <input type="text" name="place" value="{$place}" maxlength="150" />

         <h4><label>{$lang.website}</label></h4>
         <p>{$lang.website_suggest}</p>
         <input type="text" name="url" value="{$url}" maxlength="256" />

         <h4><label>{$lang.phone}</label></h4>
         <p>{$lang.phone_suggest}</p>
         <input type="text" name="phone" value="{$phone}" maxlength="13" />

         <h4><label>{$lang.tags}</label></h4>
         <p>{$lang.tags_suggest}</p>
         <input type="text" name="tags" value="{$tags}" maxlength="128" />

         <br />
         <button type="submit">{$lang.send}</button>
      </form>
      {elseif $action eq 'commentedit'}
         <form method="post" action="/index.php?c=event&amp;a=commentupdate&amp;id={$comment->getId()}">
            <textarea name="text">{$comment->getText()}</textarea><br />
            <button type="submit">{$lang.send}</button>
         </form>
      {/if}